package pers.zc.activiti.listener;

import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import pers.zc.activiti.event.TestEvent;

/**
 * @Annotion: 监听类
 * @ClassName: TestListener
 * @Author: Lin Fuyuan
 * @Date: 2019/10/29  10:44
 * @Version: 1.0
 */
@Component
public class TestListener {
    @Async
    @EventListener(TestEvent.class)
    public void listener(TestEvent testEvent){
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("从TestEvent获取属性"+testEvent.getName());;
        System.out.println("这是一个监听类,监听对应的事件,监听TestEvent.class  该类必须继承ApplicationEvent ");
    }
}
